<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
//搜索标题高亮
function heightlight($title,$q){
	$result = str_replace($q, '<font style="color:red">'.$q.'</font>', $title);
	return $result;
}
//获取会员头像
function getavatar($uid, $size){
	$dir1 = ceil($uid / 10000);
	$dir2 = ceil($uid % 10000 / 1000);
	$dir = 'phpsso_server/uploadfile/avatar/'.$dir1.'/'.$dir2.'/'.$uid.'/';
	$avatar = array('180'=>$dir.'180x180.jpg', '90'=>$dir.'90x90.jpg', '45'=>$dir.'45x45.jpg', '30'=>$dir.'30x30.jpg');
	$remote_avator = PC_DOMAIN.$avatar[$size];
	if(file_get_contents($remote_avator)){
		return $remote_avator;
	}else{
		return PC_DOMAIN.'statics/images/member/nophoto.gif';
	}
}
